package com.vlin.message.handler.tuya;

import com.alibaba.fastjson.JSONObject;

public abstract class OtherTuyaMessageHandler extends AbstractTuyaMessageHandler {

	@Override
	public boolean doSupport(JSONObject object) {
		if(!(object.containsKey("bizData") && object.containsKey("bizCode"))) {
			return false;
		}
		String code = object.getString("bizCode");
		JSONObject bizData = object.getJSONObject("bizData");
		if(code == null || bizData == null) {
			return false;
		}
		return otherSupport(code, object);
	}

	@Override
	public void doHandle(JSONObject object) {
		if(support(object)) {
			String code = object.getString("bizCode");
			JSONObject bizData = object.getJSONObject("bizData");
			otherHandler(code, bizData, object);
		}
	}

	public abstract boolean otherSupport(String code, JSONObject object);
	
	
	public abstract void otherHandler(String code, JSONObject bizData, JSONObject object);
	
}
